﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using RuleCode.Table;
using System.Data;
using RuleCode.Common;

namespace map.member
{
    public partial class ItemCate : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            AjaxPro.Utility.RegisterTypeForAjax(typeof(AjaxFunction));

        }

        [AjaxPro.AjaxMethod]
        public string GetItemCate(string parentCate)
        {
            if (parentCate == "")
                parentCate = "1"; //顶级目录分类

            string result = string.Empty;
            string filter = "taobaoparentsyscatid='" + parentCate + "'";
            taobaosyscat syscat = taobaosyscat.Find(filter);
            if (syscat.Count > 0)
            {
                int index = 0;
                result = "{[";
                do
                {
                    if (index++ > 0)
                    {
                        result += ",";
                    }
                    result += "{id:'" + syscat.taobaosyscatid.Value + "',name:'" + syscat.taobaoname.Value + "'}";
                } while (syscat.Next());
                result += "]}";
            }
            return result;
        }

    }
}
